package com.itheima.web.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//配置类
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private TokenInterceptor tokenInterceptor;

    @Override//创建拦截器管理路径
    public void addInterceptors(InterceptorRegistry registry) {
        //注册token拦截器 添加拦截路径
        registry.addInterceptor(tokenInterceptor).addPathPatterns("/**")
                //添加无需拦截的路径
                .excludePathPatterns("/system/users/verification","/system/users/login");
    }
}
